
// box model

* {
  box-sizing: border-box;
}

// typography

body, label, input, textarea, select {
  font-family: $font-family;
  font-size: $font-size;
  line-height: $line-height;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
// structure

.clear {
  clear: both;
}

body {
  color: $color-dark;
  padding: 0;
  margin: 0;
  &.home {
    background-color: $home-bg;
  }
}

.wrapper{
  h1,
  h2,
  h3,
  h4,
  h5 {
    line-height: 1.28571429em;
    font-weight: bold;
    padding: 0em;
    display: flex;
  }
  h1 {
    min-height: 1em;

    font-size: 32px;
    font-weight: 600;
    text-align: left;
    letter-spacing: 0.5px;
    line-height: 42px;

    margin-bottom: 56px;
      + h2 {
        margin-bottom: 2px;
      }
  }
  h2 {
    margin-bottom: 16px;
    margin-top: 44px;

    font-size: 22px;
    font-weight: 600;
    text-align: left;
    letter-spacing: 0;
    line-height: 28px;
  }
  h3 {
    margin-bottom: 16px;
    margin-top: 44px;

    font-size: 18px;
    font-weight: 600;
    text-align: left;
    letter-spacing: 0;
    line-height: 28px;
  }
  h4 {
    font-size: 1.07142857em;
  }
  h5 {
    font-size: 1em;
  }
  h1:first-child,
  h2:first-child,
  h3:first-child,
  h4:first-child,
  h5:first-child {
    margin-top: 0em;
  }
  h1:last-child,
  h2:last-child,
  h3:last-child,
  h4:last-child,
  h5:last-child {
    margin-bottom: 0em;
  }

  p {
    font-size: 16px;
    text-align: left;
    letter-spacing: 0;
    line-height: 24px;
    margin-bottom: 12px
  }
  p:first-child {
    margin-top: 0em;
  }
  p:last-child {
    margin-bottom: 0em;
  }

  a {
    color: #4183C4;
    text-decoration: none;
  }
  a:hover {
    color: #1e70bf;
    text-decoration: none;
  }
  
  ul {
    margin-bottom: 12px;
  }
  ol {
    list-style: decimal;
    margin-left: 2em;
  }
}

hr {
  border-color: #ddd;
  opacity: 0.3;
  margin: 2.7em 0;
}

img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

pre{
  overflow: auto;
  padding: 10px 15px;
  border-radius: 2px;
  line-height: 1em;
}

code {
  color: #ddd;
}

:not(pre) > code {
  color: $brand;
  background-color: $grey-bg;
  padding: 1px 3px;
  white-space: nowrap;
  font-weight: 600;
  border-radius: 2px;
}

.highlight {
  margin: 1em 0;
}

blockquote {
  color: $space;
  background-color: $grey-bg;
  border: 1px solid $grey-smoke;
  margin: 2em 0;
  padding: 15px;
  border-radius: 2px;
}

.wrapper {
  max-width: $content-width;
  margin: 0 auto;
  flex: 1 1 100%;
  overflow: hidden;

  &.main {
    display: flex;
  }

  &.home{
    width: 65%;
  }
}

#sidebar {
  background-color: #fff;
  z-index: 5;
  display: flex;
  flex-direction: column;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  padding: 1em;
  background-color: $color-dark;
  color: #fff;
  font-size: 0.8em;

  font-weight: 600;
  text-transform: uppercase;
  min-height: fit-content;

  ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  a {
    color: #fff;
  }
}

.toc-sidebar{
  overflow: scroll;
}

.edit-github{
  padding-top: 2em;
}

.edit-github a, .edit-github a:visited, .edit-github a:hover {
  color: #fff;
  text-decoration: none;
}

.search {
  margin-right: 14px;

  .algolia-autocomplete{
    width: 100%
  }

  input {
    padding: 0 10px 0 35px;
    border: 2px solid #E1E5E8;
    height: 44px;
    display: inline-block;
    background-color: #fff;
    color: #333;
    border-radius: 2px;
    width: 100%;
    transition: all 0.3s ease 0s;
    font-size: 16px;


    &:focus {
      outline: none;
      border: 2px solid #888888;
    }
  }

  &.home {
    width: 20%;
    margin: 0 auto;
    display: flex;
    align-items: center;

    input {
      border-radius: 2px;
      color: #fff;
      border: 1.5px solid $grey-dark;
      background-color: $space-b;
      width: 100%;
      height: 40px;

      &:hover,
      &:focus {
        border-color: $grey;
      }
    }
    .icon {
      margin-top: 0;
      opacity: 1;
    }

    ::-webkit-input-placeholder {
      color: $grey;
    }
    ::-moz-placeholder {
      color: $grey;
    }
    :-ms-input-placeholder {
      color: $grey;
    }
    :-moz-placeholder {
      color: $grey;
    }

  }

  ::-webkit-input-placeholder {
    color: $grey-dark;
  }
  ::-moz-placeholder {
    color: $grey-dark;
  }
  :-ms-input-placeholder {
    color: $grey-dark;
  }
  :-moz-placeholder {
    color: $grey-dark;
  }

  .icon {
    position: absolute;
    width: 16px;
    height: 16px;
    margin-top: 14px;
    margin-left: 10px;
    z-index: 2;
    opacity: 0.2;
  }
}

main {
  background-color: #fff;
  margin: 15px auto 0;
  padding:  20px 0;
  min-width: 100vw;
}

main.home {
  background-color: $home-bg;
}

.toc {
  width: $toc-width;
  overflow-y: auto;
  padding:  1em 1em 1em 0;
  font-size: 14px;

  li {
    font-weight: normal;
    display: none;
    margin: 16px 0;

  }

  > ul > li, .active, .active > ul > li {
    display: block;
  }

  .active {
    font-weight: bold;
  }

  a, a:visited {
    color: $color-dark;
    font-size: 14px;
    padding: 6px 0px 0 8px;
    font-weight: normal;
    text-align: left;
    letter-spacing: 0;
    line-height: 24px;
    display: flex;
    justify-content: space-between;
    align-content: center;
  }

  a:hover {
    color: #1e70bf;
    text-decoration: none;
  }

  ul {
    list-style: none;
    margin: 0 0 0 20px;
  }

  & > ul {
    margin: 0;
  }

  .level-0 {
    > a {
      width: 100%;
      height: 36px;
      background: #F1F2F4;
      border-radius: 2px;
    }
  }

  .welcome + ul > li > a:after {
    border-style: solid;
    border-width: 2px 2px 0 0;
    content: '';
    display: inline-block;
    height: 4px;
    position: relative;
    transform: rotate(135deg);
    vertical-align: top;
    width: 4px;
    border-color: #CBCED1;
    margin-right: 16px;
    align-self: center;
  }

  .welcome + ul > .active > a:after {
    transform: rotate(-45deg);
  }

  .level-1 > a {
    color: $brand;
  }

  .level-2 {

    a ~ ul {
      border-left: 2px solid #ddd;
      margin-left: 5px;
      padding-left: 10px;
      width: calc(100% - 10px);
      a {
        color: $grey-link;
        padding-top: 0;
      }
    }
    > a {
      color: $brand;
    }
  }

  .level-3 {
    border-left: 2px solid $brand;
    margin-left: -12px;
    padding-left: 10px;
    > a {
      color: $brand !important;
      font-weight: 600;
    }
  }
}

.content {
  flex: 1 1 100%;
  overflow: hidden;
  width: 100%;
  min-height: 100vh;

  .wrapper {
    font-size: 14px;
    padding-right: 1em;
    max-width: 70%;
    margin: 0 0 0 65px;
  }
}

.content .flipped {
  display: flex !important;
}

#discourse-comments {
  margin-top: 2em;
  color: $grey-dark;
}

.article-toc-wrapper{
  width: 30%;
  position: fixed;
  left: 75vw;
  .inline_toc {
    border-left: 2px solid #ddd;
    font-size: 13px;
    font-weight: 500;
    padding-left: 18px;

    a, a:visited {
      margin-bottom: 16px;
      color: $grey-link;
      font-size: 14px;
      font-weight: normal;
      text-align: left;
      letter-spacing: 0;
      line-height: 24px;
    }

    a:hover {
      color: #1e70bf;
      text-decoration: none;
    }

    a.active {
      color: $brand;
      margin-left: -20px;
      padding-left: 18px;
      border-left: 2px $brand solid;
    }

    :last-child a {
      margin-bottom: 0;
    }
  }
}

.burger {
  display: none;
}

.search-button {
  display: none;
}
// home screen

.project-list {
  display: grid;
  grid-template-columns: repeat(2, 0.5fr);
  grid-gap: 25px;
  margin: 4em 0;
}

.project-card {
  display: flex;
  background-color: $space-b;
  padding: 24px 20px;
  margin: 0 auto;
  min-height: 232px;
  width: 100%;
  border-radius: 2px;
  flex-direction: column;
}

.project-card__header {
  display: flex;
  margin-bottom: 24px;
}

.project-card-title__title {
  margin: 0 !important;
  a {
  font-size: 20px;
  color: #fff;
  display: block;
  font-weight: 600;
  }
}

.project-card-title__description {
  color: $grey-light;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  letter-spacing: 0;
  line-height: 24px;
}

.project-card-icon__wrapper {
  padding: 12px;
  background-color: $grey-dark;
  border-radius: 100px;
  margin-right: 16px;
  height: 56px;
  width: 56px;
}

.project-card-icon {
  height: 30px;
  width: 30px;
}

.home-hero{
  background: url("./images/default/hero.jpg");
  background-repeat: no-repeat;
  background-position: bottom;
  background-size: 100% auto;

  min-height: 90vh;
  padding: 6em 0;

  color: white;
  text-align: center;
}

.home-header {
  display: flex;
  flex-direction: column;
  margin: 10px 0;
  &.card{
    margin-bottom: 0;
  }
}

.home-hero__title {
  margin: 0 0 40px 0;
  display: block;
  font-weight: bold;
  font-size: 44px;
}

.card-pages{
  display: grid;
  grid-template-columns: repeat(2, 0.8fr);
  grid-gap: 8px 24px;
  justify-content: left;

  font-size: 0.8em;
  font-weight: bold;
  max-width: 320px;
  & a {
    color: $brand;
    font-size: 16px;
    height: auto;
    letter-spacing: 0;
    line-height: 24px;
    text-align: left;
    width: 228px;
  }
}

#algolia-autocomplete-listbox-0 {
  max-width: none;
  min-width: none;
  width: 100%;
}

// Custom data table styles...
td > code {
  background: none;
}

.content table {
  display: table;
  width: 100%;
  margin: 1em auto;
  border-top: 1px solid #bfbfbf;
  border-collapse: collapse;
  border-spacing: 0;
}

.content .table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.content table thead th {
  font-size: 18px;
  line-height: 22px;
  padding: 12px 9px;
  font-weight: bold;
  text-align: left;
  vertical-align: top;
}
.content table tbody {
  border-bottom: 1px solid #bfbfbf;
}
.content table tbody td {
  font-size: 16px;
  line-height: 22px;
  padding: 12px 9px;
  font-weight: normal;
  text-align: left;
  vertical-align: top;
}
.content table tbody tr:nth-child(odd) td {
  background: #EEE;
}
.content table tbody tr:nth-child(even) td {
  background: transparent;
}

// mobile

@media all and (max-width: 1200px) {
  .toc {
    max-height: unset;
    max-width: fit-content;
    border: none;
  }

  .article-toc-wrapper{
    display: none;
  }

  .home-hero{
    background-size: 250% auto;
    background-position: center bottom;
    min-height: 500px;

    padding: 44px 32px;

    color: white;
    text-align: center;

    &__title {
      text-align: center;
      font-size: 32px;
      font-weight: 700;
      letter-spacing: 0.5px;
      line-height: 42px;
      margin-bottom: 30px;
    }
  }

  .search.home {
    width: 100%;
  }

  .content .wrapper{
    width: 95%;
    margin: 0 auto;
  }

  .mobile-search {
    margin-bottom: 2em;
    display: flex;
    align-items: center;
    .search {
      width: 100%;
      padding: 0 1em;
      input, .algolia-autocomplete {
        width: 100%;
      }
    }
  }

  .card-pages {
    grid-template-columns: repeat(1, 0.8fr);
  }

  .project-card {
    margin: 0;
    height: 334px;
  }

  .burger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 38px;
    height: 38px;
    padding: 10px 6px;
    cursor: pointer;
  }

  .burger span {
    content: "";
    background-color: $space;
    width: 100%;
    height: 2px;
  }

  .header-items ul {
    display: none;
  }

  .content {
    width: 100%;
    font-size: 0.8em;
    padding: 0 1em;
  }

  .content .flipped {
    display: flex !important;
    flex-direction: column-reverse;
  }

  .article-toc-wrapper {
    order: 1;
    height: fit-content;
    width: 100%;

    margin-bottom: 1em;
    padding: 1em 0 1em 0;
    border-left: none;
    border-bottom: 1px solid #ddd;
    border-top: 1px solid #ddd;
  }


  .project-list {
    display: grid;
    grid-template-columns: repeat(1, 0.8fr);
    grid-gap: 25px;
    justify-content: center;
  }

  .wrapper {
      &.main{
        padding: 0px;
        flex-direction: column;
      }
      &.home{
        width: 100%;
      }
    }
}

// Anchor Links

.header-link {
  display: none;
  order: 2;
  margin: 0 10px;
  img {
    width: 15px;
    height: 15px;
  }
}

h2:hover .header-link,
h3:hover .header-link,
h4:hover .header-link,
h5:hover .header-link,
h6:hover .header-link {
  display: flex;
  align-items: center;
}

@media all and (min-width: 2000px) {
  .home-hero{
    background: url("./images/default/hero2x.jpg");
    background-repeat: no-repeat;
    background-position: bottom;
    background-size: 100% auto;

    min-height: 80vh;
    padding: 6em 0;

    color: white;
    text-align: center;
  }
  .article-toc-wrapper{
    left: 70vw;
  }
}

@media all and (max-width: 1500px) {
  .card-pages a {
    max-width: 240px;
    width: unset;
  }
}